package com.yunb.controller;

import com.yunb.service.RedisRedWarsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/red")
public class RedWarController {

    @Autowired
    private RedisRedWarsService redisRedWarsService;

    @GetMapping("/start")
    public String redWar(){
        String result ="";
        try {
            //redisRedWarsService.qianghongbao();
            redisRedWarsService.initRedBao();
            result = "success";
        } catch (Exception e) {
            result = "fail";
            throw new RuntimeException(e);
        }finally {

            return result;
        }
    }
    @GetMapping("/start1")
    public String redWarSelf(){
        String result ="";
        try {
            redisRedWarsService.initRedBao();
            result = "success";
        } catch (Exception e) {
            result = "fail";
            throw new RuntimeException(e);
        }finally {

            return result;
        }
    }
}
